/*
 * @Description: Vuex状态管理
 * @Author: 0001100986/LiuShuai
 * @Date: 2021-06-22 14:09:49
 * @LastEditTime: 2021-07-16 09:36:36
 * @LastEditors: 0001100986/LiuShuai
 */
import Vue from 'vue';
import Vuex from 'vuex';

Vue.use(Vuex);
// 打开vue调试工具
Vue.config.devtools = true;
const files = require.context('./modules', false, /\.js$/);
const modules = {};

files.keys().forEach((key) => {
  modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default;
});

Object.keys(modules).forEach((key) => {
  modules[key]['namespaced'] = true;
});

const store = new Vuex.Store({
  modules
});

export default store;